
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0px;
            padding: 0px;
            box-sizing: border-box;
        }
        img{
            width: 640px;
            height: 320px;
        }
    </style>
</head>
<body>
    <div class="">
        <img src="img/1.jpg" alt="">
    </div>
    <div class="">
        <button>1</button>
        <button>2</button>
        <button>3</button>
    </div>
    
    <script src="jquery.js"></script>
    <script>
        let arr=["img/1.jpg","img/2.jpg","img/3.jpg"];
        $("button:eq(0)").css("background-color","red")
        $("button").click(function(){
            let i=$(this).index();
            $("img").attr("src",arr[i]);
            $(this).css("background-color","red")
            $(this).siblings().css("background-color","#ffffff")
        })
    </script>
</body>
</html>